package com.lin.manager.rabbitmq.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.ReturnedMessage;
import org.springframework.amqp.rabbit.connection.CorrelationData;

/**
 * @作者: 林江
 * @创建时间: 2024/4/14
 * @功能:
 */
@Slf4j
public class DefaultRabbitmqMessageRecordService implements RabbitmqMessageRecordService {

    @Override
    public void confirm(CorrelationData correlationData, boolean ack, String cause) {
        log.info("confirm消息响应结果：{}，消息内容：{}", ack, correlationData);
        if (!ack) {
            log.error("错误信息：{}", cause);
        }
    }

    @Override
    public void returns(ReturnedMessage returned) {
        log.error("return投递消息失败，code：{}，msg：{}，内容：{}", returned.getReplyCode(), returned.getReplyText(), returned);
    }
}
